﻿<UserControl x:Class="eGrid_App.ArcGisMap"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:s="http://schemas.microsoft.com/surface/2008"
    xmlns:esri="http://schemas.esri.com/arcgis/client/2009"    
    SizeChanged="UserControl_SizeChanged">

    <Grid x:Name="LayoutRoot" Background="White">
        
        <Grid.Resources>
            <!--Symbols for annotations-->
            <esri:SimpleLineSymbol x:Key="DrawLineSymbol" Color="Green" Width="4" />
            <esri:SimpleFillSymbol x:Key="DrawFillSymbol" Fill="#3300FF00" BorderBrush="Green" BorderThickness="2" />
            <esri:SimpleMarkerSymbol x:Key="DefaultMarkerSymbol" Color="Red" Size="12" Style="Circle" />
            <esri:SimpleLineSymbol x:Key="DefaultLineSymbol" Color="Red" Width="4" />
            <esri:SimpleFillSymbol x:Key="DefaultFillSymbol" Fill="#33FF0000" BorderBrush="Red" BorderThickness="2" />            
            <!--Symbols for the trouble ticket pins layer-->
            <esri:SimpleMarkerSymbol x:Key="HighPriorityPinSymbol" Color="Red" Size="25" Style="Circle" />
            <esri:SimpleMarkerSymbol x:Key="MediumPriorityPinSymbol" Color="Orange" Size="25" Style="Circle" />
            <esri:SimpleMarkerSymbol x:Key="LowPriorityPinSymbol" Color="Yellow" Size="25" Style="Circle" />  
            <!-- Symbols for vehicles -->
            <esri:PictureMarkerSymbol x:Key="VehicleSymbol" Width="25" Height="25" Source="Resources/car.png"/>
            
        </Grid.Resources>

        <Grid.RowDefinitions>
            <RowDefinition Height="50"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="50"/>
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="50"/>
            <ColumnDefinition Width="*"/>
            <ColumnDefinition Width="50"/>
        </Grid.ColumnDefinitions>
        
        <esri:Map x:Name="MyMap" Background="AliceBlue" ExtentChanged="MyMap_ExtentChanged" 
                  Initialized="MyMap_Initialized" ExtentChanging="MyMap_ExtentChanging"
                  TouchDown="MyMap_TouchDown" TouchUp="MyMap_TouchUp"
                  Grid.Column="0" Grid.Row="0" Grid.ColumnSpan="3" Grid.RowSpan="3"
                  >
            <!--<esri:Map.Layers>-->
                <!--Dynamic Map Service Layers-->
                <!--<esri:ArcGISDynamicMapServiceLayer ID="Demographics" Opacity="0" 
                    Url="http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Demographics/ESRI_Population_World/MapServer"/>
                <esri:ArcGISDynamicMapServiceLayer ID="Elevation" Opacity="0" 
                    Url="http://sampleserver4.arcgisonline.com/ArcGIS/rest/services/Elevation/ESRI_Elevation_World/MapServer"/>-->
                
                <!--Image Service Layers-->
                <!--<esri:ArcGISImageServiceLayer ID="MODIS" Opacity="0"
                    Url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/World/MODIS/ImageServer"/>
                <esri:ArcGISImageServiceLayer ID="Temperature" Opacity="0"
                    Url="http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/World/Temperature/ImageServer"/>-->

                <!--Graphic Layers-->
                <!--<esri:GraphicsLayer ID="TroubleTicketsLayer" />
                <esri:GraphicsLayer ID="VehiclesLayer" />
                <esri:GraphicsLayer ID="AnnotationsLayer" />-->
            <!--</esri:Map.Layers>-->
        </esri:Map>

        <Border x:Name="LayersListBorder" Background="#996495ED" BorderThickness="1" CornerRadius="5"
            Grid.Row="1" Grid.Column="1" BorderBrush="Black" Visibility="Hidden">
            
            <s:SurfaceListBox x:Name="LayersList" ItemsSource="{Binding ElementName=MyMap, Path=Layers}" Visibility="Hidden">
                <s:SurfaceListBox.ItemTemplate>
                    <DataTemplate>
                        <StackPanel Orientation="Horizontal">
                            <!--Layer visibility checkbox-->
                            <s:SurfaceCheckBox IsChecked="{Binding Visible, Mode=TwoWay}" />
                            <!--Opacity slider-->
                            <s:SurfaceSlider Margin="-5,0,0,0" Minimum="0" Maximum="1" MinWidth="50" 
                                Value="{Binding Opacity, Mode=TwoWay}" Height="18" />
                            <!--Layer name-->
                            <TextBlock Text="{Binding ID, Mode=OneWay}" Margin="5,0,0,0" > 
                            <!-- Tooltip on hover-->
                                <ToolTipService.ToolTip>
                                    <StackPanel MaxWidth="400">
                                        <TextBlock FontWeight="Bold" Text="{Binding CopyrightText}" TextWrapping="Wrap" />
                                        <TextBlock Text="{Binding Description}" TextWrapping="Wrap" />
                                    </StackPanel>
                                </ToolTipService.ToolTip>
                            </TextBlock>
                        </StackPanel>
                    </DataTemplate>
                </s:SurfaceListBox.ItemTemplate>
            </s:SurfaceListBox>
        </Border>

        <!--<Canvas x:Name="AnnotationsToolbar" Width="300" Height="100" HorizontalAlignment="Center" VerticalAlignment="Center" 
                Grid.Row="1" Grid.Column="1" Visibility="Hidden">
            <Rectangle Stroke="Gray"  RadiusX="10" RadiusY="10" Fill="#77919191" Canvas.Left="0" 
                       Canvas.Top="0" Width="300" Height="100" >
                <Rectangle.Effect>
                    <DropShadowEffect/>
                </Rectangle.Effect>
            </Rectangle>
            <Rectangle Fill="#FFFFFFFF" Stroke="DarkGray" RadiusX="5" RadiusY="5" Canvas.Left="10" 
                       Canvas.Top="10" Width="280" Height="80"  />
            <TextBlock x:Name="ToolTile" Foreground="Black" Width="280" TextAlignment="Center" 
                       FontSize="9" FontWeight="Bold" Canvas.Left="20" Canvas.Top="10" 
                       Text="Use these tools to add graphics to the map." />
            <StackPanel Orientation="Vertical" Canvas.Top="5" Canvas.Left="10">
                <esri:Toolbar x:Name="MyToolbar" MaxItemHeight="80" MaxItemWidth="80"
                    Grid.Row="0" VerticalAlignment="Top" HorizontalAlignment="Center"
                    ToolbarItemClicked="MyToolbar_ToolbarItemClicked" 
                    ToolbarIndexChanged="MyToolbar_ToolbarIndexChanged"
                    Width="280" Height="70">
                    <esri:Toolbar.Items>
                        <esri:ToolbarItemCollection>
                            <esri:ToolbarItem Text="Add a point">
                                <esri:ToolbarItem.Content>
                                    <Image Source="Resources/Buttons/ESRI_Stuff/DrawPoint.png" Stretch="UniformToFill"/>
                                </esri:ToolbarItem.Content>
                            </esri:ToolbarItem>
                            <esri:ToolbarItem Text="Add a Polyline">
                                <esri:ToolbarItem.Content>
                                    <Image Source="Resources/Buttons/ESRI_Stuff/DrawPolyline.png" Stretch="UniformToFill"/>
                                </esri:ToolbarItem.Content>
                            </esri:ToolbarItem>
                            <esri:ToolbarItem Text="Add a Polygon">
                                <esri:ToolbarItem.Content>
                                    <Image Source="Resources/Buttons/ESRI_Stuff/DrawPolygon.png" Stretch="UniformToFill"/>
                                </esri:ToolbarItem.Content>
                            </esri:ToolbarItem>
                            <esri:ToolbarItem Text="Add a Rectangle">
                                <esri:ToolbarItem.Content>
                                    <Image Source="Resources/Buttons/ESRI_Stuff/DrawRectangle.png" Stretch="UniformToFill"/>
                                </esri:ToolbarItem.Content>
                            </esri:ToolbarItem>
                            <esri:ToolbarItem Text="Draw Freehand">
                                <esri:ToolbarItem.Content>
                                    <Image Source="Resources/Buttons/ESRI_Stuff/DrawFreehand.png" Stretch="UniformToFill"/>
                                </esri:ToolbarItem.Content>
                            </esri:ToolbarItem>
                            <esri:ToolbarItem Text="Clear Graphics">
                                <esri:ToolbarItem.Content>
                                    <Image Source="Resources/Buttons/ESRI_Stuff/StopDraw.png" Stretch="UniformToFill"/>
                                </esri:ToolbarItem.Content>
                            </esri:ToolbarItem>
                        </esri:ToolbarItemCollection>
                    </esri:Toolbar.Items>
                </esri:Toolbar>
                <TextBlock x:Name="StatusTextBlock" Text="" FontWeight="Bold" HorizontalAlignment="Center"/>
            </StackPanel>
        </Canvas>-->

    </Grid>
</UserControl>